package demo;

import java.io.*;

public class ImageCopy {
    public static void main(String[] args) {
        String oriPic = "E:" + File.separator + "class2110" + File.separator + "opp.jpg";
        String dstPic = "D:" + File.separator + "vnc" + File.separator + "pop.jpg";

        File oriFile = new File(oriPic);
        File dstFile = new File(dstPic);

        try {
            InputStream inputStream = new FileInputStream(oriFile);
            OutputStream outputStream = new FileOutputStream(dstFile);

            int temp = 0;
            while (((temp) = inputStream.read()) != -1) {
                outputStream.write(temp);
            }

            System.out.println("copy成功");
            outputStream.close();
            inputStream.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
